package com.dotflat.survey.domain;

import com.aliyun.openservices.shade.org.apache.commons.lang3.builder.HashCodeExclude;
import com.dotflat.rest.domain.AreableObjectBase;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;

@Entity
@Table(name = "dw_survey_answer_item")
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("答卷条目")
public class SurveyAnswerItem extends AreableObjectBase {

    @Column(columnDefinition = "varchar(32)  COMMENT '问卷id'", nullable = false)
    @ApiModelProperty("问卷id")
    private String sheetId;

    @Column(columnDefinition = "varchar(32)  COMMENT '答题卡id'", nullable = false)
    @ApiModelProperty("答题卡id")
    private String answerId;

    @ManyToOne
    @JoinColumn(name = "answerId", columnDefinition = "varchar(32) COMMENT '答卷id'", insertable = false, updatable = false)
    @JsonIgnore
    @HashCodeExclude
    @ApiModelProperty(value = "答卷id", hidden = true)
    private SurveyAnswer answer;

    @Column(columnDefinition = "varchar(32)  COMMENT '题目id'", nullable = false)
    @ApiModelProperty("题目id")
    private String itemId;

    @Column(columnDefinition = "varchar(32)  COMMENT '题目内容'", nullable = false)
    @ApiModelProperty("题目内容")
    private String itemTitle;

    @Column(columnDefinition = "int(3)  COMMENT '序号'", nullable = false)
    @ApiModelProperty("序号")
    private String seq;

    @Column(columnDefinition = "int(3)  COMMENT '选项index'")
    @ApiModelProperty("选项index")
    private Integer optionIndex;

    @Column(columnDefinition = "varchar(128)  COMMENT '文本内容，多选内容，选择内容'", nullable = false)
    @ApiModelProperty("文本内容，多选内容，选择内容")
    private String value;
}
